<template>
	<view class="contens">
		<view class="activityList">
			<view class="rank">
				<activity-list :activity="activity"></activity-list>
			</view>
		</view>
		<u-loadmore :status="status" />
	</view>
</template>

<script>
	import {
		getActivityList
	} from "@/nxTemp/apis/activity.js"
	export default {
		data() {
			return {
				activity: [],
				pages: 1,
				status: "loading",
			}
		},
		onLoad() {
			this.findactivityList({
				"nowPage": 1,
				"pageSize": 20,
				"requestId": 0,
				"userId": 0
			})
		},
		onShow() {
			let user = uni.getStorageSync("user");
			if (!user) {
				user = '';
			}
			this.user = user;
		},
		onReachBottom() {
			this.findactivityList({
				"nowPage": this.pages,
				"pageSize": 20,
				"requestId": 0,
				"userId": 0
			})
		},
		methods: {
			findactivityList: function(args) {
				getActivityList(args).then(res => {
						if (res.length < 20) {
							this.isLastPage = true;
							this.status = "nomore"
						}
						this.pages = this.pages + 1
						
						this.activity = this.activity.concat(res.records)

					})
					.catch(err => {})
			},
			onItemClick: function(id) {
				uni.navigateTo({
					url: '../message/message?id=' + id
				})
			}
		},

	}
</script>

<style lang="scss" scoped>
	.activityList {
		padding: 60rpx 0rpx;
		.rank {
			padding-top: 0rpx;
		}
	}


	.item-container {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		box-sizing: border-box;

		.item {
			position: relative;
			width: 100%;
			min-height: 216rpx;
			display: flex;
			flex-direction: row;
			justify-content: flex-start;
			align-items: flex-start;
			box-sizing: border-box;
			padding: 0 32rpx;
			padding-top: 34rpx;
			padding-bottom: 32rpx;
			background: #FFFFFF;

			.item-avatar {
				width: 80rpx;
				height: 80rpx;
				border-radius: 40rpx;
			}

			.item-middle {
				width: 480rpx;
				display: flex;
				flex-direction: column;
				justify-content: flex-start;
				align-items: flex-start;
				box-sizing: border-box;
				margin-left: 24rpx;

				.item-middle-name {
					font-size: 28rpx;
					color: #576B95;
				}

				.item-middle-content {
					font-size: 28rpx;
					color: #333333;
					margin-top: 8rpx;
					font-weight: 500;
				}

				.item-middle-time {
					font-size: 24rpx;
					color: #999999;
					margin-top: 26rpx;
				}

				.item-right-text {
					position: absolute;
					width: 100rpx;
					right: 32rpx;
					line-height: 40rpx;
					text-align: center;
					align-self: center;
					font-size: 24rpx;
					color: #999999;
				}

				.item-right {
					position: absolute;
					right: 32rpx;
					width: 32rpx;
					height: 34rpx;
					align-self: center;
				}

			}
		}
	}
</style>
